<?php
class Managecategory_Data_Allcategories {
	
	private $database;
	
	public function __construct(){
		
		$this->database = new Core_Driver_MysqlImproved();
		
	}
	
	public function getCategoriesList(){
		$this->database->connect();
		$this->database->prepare(
			"
				SELECT 
				*
				FROM 
				category_settings
				ORDER
				BY
				category_name
				ASC
				;
				"
		);
		$this->database->query();
		$article['content'] = '<tbody><tr><th>'.COLUMNN_NAME.'</th><th>'.ACTION_NAME.'</th></tr>';
		while($articlesData = $this->database->fetch('array')){
			$article['content'] .= "<tr><td>
					".$articlesData['category_name']."</td><td> 
							<a href=\"".SERVER_ROOT."?managecategory&page=remove&name=".$articlesData['category_name']."\">
							".ALL_CATEGORIES_REMOVE."
							</a>
							<a href=\"".SERVER_ROOT."?managecategory&page=edit&name=".$articlesData['category_name']."\">
									".ALL_CATEGORIES_EDIT."</a></td</tr>
					";
		}
		$article['content'] .= "</tbody>";
		return $article;
	}
}